<template>
  <div id="main">
    <!-- 用户登录 -->
    <loginVue></loginVue>
    <!-- 导航条 -->
    <HeaderVue></HeaderVue>
    <!-- 内容 -->
    <router-view></router-view>
    <!-- 尾部版权 -->
    <FooterVue></FooterVue>
  </div>
</template>

<script>
import HeaderVue from "@/components/Header";
import FooterVue from "@/components/FooterNav";
import loginVue from "@/components/user/login"
import {mapState,mapMutations} from "vuex"
export default {
  name: 'App',
  components: {
    HeaderVue,
    FooterVue,
    loginVue
  },
  methods:{
    ...mapMutations(['altUserInfo',"exitUserInfo"]),
    // 判断是否登录
    async isLogin(){
      let {data} = await this.$axios.post("/client/user/judge")
      if(data.code){
        // 退出登录
        this.exitUserInfo()
        return
      }
      // 更新数据
      this.altUserInfo(data.data)
    },
  },
  created(){
    // 是否登录
    this.isLogin()
  },
  computed:{
    ...mapState(["userInfo"])
  }
}
</script>

<style>
@import "assets/css/reset.css"; 
@import "assets/css/iconfont.css";

::-webkit-scrollbar {/*滚动条整体样式*/
  width: 10px;     /*高宽分别对应横竖滚动条的尺寸*/
  height: 1px;
}
::-webkit-scrollbar-thumb {/*滚动条里面小方块*/
  border-radius: 5px;
  -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
  background: #FFC001;
  /* background: ; */
}
::-webkit-scrollbar-track {/*滚动条里面轨道*/
  -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.1);
  border-radius: 10px;
  background: #EDEDED;
}
</style>
